cmake_minimum_required(VERSION 3.15)
project(reactor_http_cpp LANGUAGES CXX)

# 设置 C++ 标准（根据项目需求调整，这里用 C++17）
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# 设置编译输出目录
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)  # 可执行文件输出到 bin
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)  # 动态库输出到 lib
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)  # 静态库输出到 lib

find_package(Threads REQUIRED)

# 编译选项（启用警告和优化）
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
    add_compile_options(-Wall -Wextra -Werror=return-type -O0 -g)
elseif(MSVC)
    add_compile_options(/W4 /WX /O2)
endif()

# 添加子目录（仅需添加 src，内部子模块由 src/CMakeLists.txt 管理）
add_subdirectory(src)